From 732b0c32c93771ebd075d051e81a40af2fd219b1 Mon Sep 17 00:00:00 2001 From: justbur Date: Thu, 9 Jul 2015 20:46:49 -0400 Subject: [PATCH] Try out status-key option --- which-key.el | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/which-key.el b/which-key.el index cbc3a2b87b1..c0395451800 100644 --- a/which-key.el +++ b/which-key.el @@ -569,14 +569,17 @@ the maximum number of lines availabel in the target buffer." (defun which-key/populate-buffer (prefix-keys formatted-keys column-width sel-win-width) "Insert FORMATTED-STRINGS into which-key buffer, breaking after BUFFER-WIDTH." - (let* ((vertical-mode (member which-key-side-window-location '(left right))) + (let* ((vertical-mode (and (eq which-key-popup-type 'side-window) + (member which-key-side-window-location '(left right)))) + (n-status-key 1) + (which-key-show-prefix nil) (prefix-w-face (which-key/propertize-key prefix-keys)) (prefix-len (+ 2 (length (substring-no-properties prefix-w-face)))) (prefix-string (when which-key-show-prefix (if (eq which-key-show-prefix 'left) (concat prefix-w-face " ") (concat prefix-w-face "-\n")))) - (n-keys (length formatted-keys)) + (n-keys (+ n-status-key (length formatted-keys))) (max-dims (which-key/popup-max-dimensions sel-win-width)) (max-height (when (car max-dims) (car max-dims))) (max-width-for-columns (if (cdr max-dims) @@ -590,11 +593,18 @@ the maximum number of lines availabel in the target buffer." n-columns)) (act-width (+ (* n-columns column-width) (if (eq which-key-show-prefix 'left) prefix-len 0))) - ;; (avl-lines/page (which-key/available-lines)) (max-keys/page (when max-height (* n-columns max-height))) (n-pages (if (> max-keys/page 0) (ceiling (/ (float n-keys) max-keys/page)) 1)) + (n-keys-pg1 (- (if (= 1 n-pages) n-keys max-keys/page) n-status-key)) + (count (format "- [%s/%s]" n-keys-pg1 (- n-keys n-status-key))) + ;; (count-len (length count)) + (status-key (concat prefix-keys count)) + (status-key (s-pad-right column-width " " status-key)) + (status-key (propertize status-key 'face 'font-lock-comment-face)) + (fmtd-keys (if (= 1 n-status-key) (push status-key formatted-keys) formatted-keys)) pages act-height first-page) + (message "%s" status-key) (if (and (> n-keys 0) (> n-columns 0)) (progn (dotimes (p n-pages) -- 2.30.2